﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ZombieSurvival
{
    abstract class Item : GameObject, IDrawable, IContainable
    {
        public string Name { get; private set; }
        public string Description { get; private set; }
        public Material ItemMainMaterial { get; private set; }
        public Material ItemSecondaryMaterial { get; private set; }
        public int Charges { get; set; } //if charges <0, means can be countless many times?
        public int Volume { get; set; }
        public int Weight { get; set; }
        public int Id { get; set; }

        private Texture2D _objectTexture;

        private Vector2 _screenPosition;

        protected Item(string name, string description, Material itemMaterial, Material itemSecondaryMaterial, int charges, int volume, int weight, int id)
        {
            Id = id;
            ItemSecondaryMaterial = itemSecondaryMaterial;
            Weight = weight;
            Volume = volume;
            Charges = charges;
            ItemMainMaterial = itemMaterial;
            Description = description;
            Name = name;
        }

        public void Initialize(Texture2D texture, Vector2 screenposition)
        {
            this.ObjectTexture = texture;
            this.ScreenPosition = screenposition;
        }

        public Texture2D ObjectTexture
        {
            get { return _objectTexture; }
            set
            {
                _objectTexture = value;
                _objectTexture = ObjectTexture;
            }
        }

        public Vector2 ScreenPosition
        {
            get { return _screenPosition; }
            set
            {
                _screenPosition = value;
                _screenPosition = ScreenPosition;
            }
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(ObjectTexture, ScreenPosition, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f);
        }
    }
}
